package main.com.java.shiyan;

public class MaxSubSumOfSequence {
    public String maxArray(String s) {
        int sum = 0;
        int max;
        String x=s;
        String[] xs = x.split(",");
        int[] l = new int[xs.length];
        for (int i = 0; i < xs.length; i++) {
            l[i] = Integer.parseInt(xs[i]);
        }
        max = l[0];
        for (int i = 0; i < l.length; i++) {
            if (sum > 0)
                sum += l[i];
            else
                sum = l[i];
            max = Math.max(max, sum);
        }
        return ""+max;
    }
}
